package com.antis.olsl.magic.efficiency.brand;

import android.text.TextUtils;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.antis.olsl.arouterlib.MagicRoutePath;
import com.antis.olsl.base.BaseActivity;
import com.antis.olsl.base.utils.ToastUtil;
import com.antis.olsl.magic.databinding.ActivityBrandEfficiencyDetailBinding;
import com.antis.olsl.magic.response.GetBrandEfficiencyListResp;

import timber.log.Timber;

/**
 * 品牌货效详情
 *
 * @author hhh
 */
@Route(path = MagicRoutePath.ACTIVITY_BRAND_EFFICIENCY_DETAIL)
public class BrandEfficiencyDetailActivity extends BaseActivity<ActivityBrandEfficiencyDetailBinding> {

    @Autowired
    GetBrandEfficiencyListResp.ContentBean bean;

    @Override
    protected ActivityBrandEfficiencyDetailBinding getViewBinding() {
        return ActivityBrandEfficiencyDetailBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    protected void initViews() {
        ARouter.getInstance().inject(this);
        Timber.tag("hhh").e("bean= " + bean);
        if (null == bean) {
            ToastUtil.showToast(this, "数据为空");
            return;
        }

        if (!TextUtils.isEmpty(bean.brandName)) {
            viewBinding.textBrandName.setText(bean.brandName);
        }

        String storeNum;
        if (!TextUtils.isEmpty(bean.storeNum)) {
            storeNum = "上货门店 " + bean.storeNum;
        } else {
            storeNum = "上货门店 0";
        }
        viewBinding.textStoreNum.setText(storeNum);

        if (!TextUtils.isEmpty(bean.brandAmount)) {
            viewBinding.layoutBrandSales.textBrandAmount.setText(bean.brandAmount);
        }

        if (!TextUtils.isEmpty(bean.brandNumber)) {
            viewBinding.layoutBrandSales.textBrandNumber.setText(bean.brandNumber);
        }

        if (!TextUtils.isEmpty(bean.brandProfit)) {
            viewBinding.layoutBrandSales.textBrandProfit.setText(bean.brandProfit);
        }

        if (!TextUtils.isEmpty(bean.singleAmount)) {
            viewBinding.layoutSingleContribution.textSingleAmount.setText(bean.singleAmount);
        }

        if (!TextUtils.isEmpty(bean.singleNumber)) {
            viewBinding.layoutSingleContribution.textSingleNumber.setText(bean.singleNumber);
        }

        if (!TextUtils.isEmpty(bean.singleProfit)) {
            viewBinding.layoutSingleContribution.textSingleProfit.setText(bean.singleProfit);
        }

        if (!TextUtils.isEmpty(bean.averageAmount)) {
            viewBinding.layoutAverageContribution.textAverageAmount.setText(bean.averageAmount);
        }

        if (!TextUtils.isEmpty(bean.averageNumber)) {
            viewBinding.layoutAverageContribution.textAverageNumber.setText(bean.averageNumber);
        }

        if (!TextUtils.isEmpty(bean.averageProfit)) {
            viewBinding.layoutAverageContribution.textAverageProfit.setText(bean.averageProfit);
        }

        if (!TextUtils.isEmpty(bean.singlePermeability)) {
            viewBinding.layoutOtherView.textOtherAmount.setText(bean.singlePermeability);
        }

        if (!TextUtils.isEmpty(bean.stockQuantity)) {
            viewBinding.layoutOtherView.textOtherNumber.setText(bean.stockQuantity);
        }

        if (!TextUtils.isEmpty(bean.stockAmount)) {
            viewBinding.layoutOtherView.textOtherProfit.setText(bean.stockAmount);
        }
    }

    @Override
    protected void initData() throws IllegalAccessException {

    }
}